﻿using Autofac;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceCS.Autofac.Core
{
    public static class OC
    {
        public static IContainer Container { get; set; }
        // Create your builder.
        private static ContainerBuilder builder;
        static OC()
        {

        }

        private static ContainerBuilder BuildContainer()
        {
            builder = new ContainerBuilder();
            // Usually you're only interested in exposing the type
            // via its interface:
            builder.RegisterType<ConsoleOutput>().As<IOutput>();

            // However, if you want BOTH services (not as common)
            // you can say so:
            builder.RegisterType<TodayWriter>().AsSelf().As<IDateWriter>();
            Container = builder.Build();
            return builder;
        }
        public static ContainerBuilder Configure()
        {
            builder = BuildContainer();
            return builder;
        }
    }
}
